import java.util.*;

/**
 * @author LKQ
 * @date 2022/4/3 13:12
 * @description 原地修改，无需另辟空间
 */
public class Solution3 {
    public static void main(String[] args) {

    }
    public int triangularSum(int[] nums) {
        for (int n = nums.length - 1; n >= 1; n--){
            for (int i = 0; i < n; i++){
                nums[i] = (nums[i] + nums[i+1]) % 10;
            }
        }
        return nums[0];
    }

}
